package com.bruce.asurada.sso.exception;

/**
 * 服务调用异常
 * @author Bruce
 */
public class ServiceCallException extends RuntimeException {
    
    private final String serviceName;
    private final String methodName;
    private final int statusCode;

    public ServiceCallException(String serviceName, String methodName, int statusCode, String message) {
        super(String.format("服务调用失败 - 服务: %s, 方法: %s, 状态码: %d, 错误: %s", 
                           serviceName, methodName, statusCode, message));
        this.serviceName = serviceName;
        this.methodName = methodName;
        this.statusCode = statusCode;
    }

    public ServiceCallException(String serviceName, String methodName, String message, Throwable cause) {
        super(String.format("服务调用失败 - 服务: %s, 方法: %s, 错误: %s", 
                           serviceName, methodName, message), cause);
        this.serviceName = serviceName;
        this.methodName = methodName;
        this.statusCode = 0;
    }

    public String getServiceName() {
        return serviceName;
    }

    public String getMethodName() {
        return methodName;
    }

    public int getStatusCode() {
        return statusCode;
    }
}